﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using IOEntity;

namespace IOBusiness
{
  public  class clsBSGetHTML
    {
        public String getHTML(string src,clsTemplete temp)
        {
            try
            {
                String s = "";
                 using (StreamReader sr = new StreamReader(src))
                {
                    String line;
                   
                    while ((line = sr.ReadLine()) != null)
                    {
                        s += line;
                    }
                    
                }
                 return updateContentTemp(s, temp);;
            }
            catch (Exception)
            {
                
                throw;
            }
        }


        private string updateContentTemp(string content,clsTemplete temp)
        {
            try
            {
               string myContent ="";
               myContent= content.Replace("[TempTourName]", temp.TourName);
               myContent = myContent.Replace("[TempMR]", temp.Mr);
               myContent = myContent.Replace("[TempFullName]", temp.Fullname);
               myContent = myContent.Replace("[TempEmail]", temp.Email);
               myContent = myContent.Replace("[TempAdd]", temp.Address);
               myContent = myContent.Replace("[TempNationlity]", temp.Nationality);
               myContent = myContent.Replace("[TempPhone]", temp.Phone);
               myContent = myContent.Replace("[TempFax]", temp.Fax);
               myContent = myContent.Replace("[TempTourName]", temp.TourName);
               myContent = myContent.Replace("[TempTripStart]", temp.TripStartDate);
               myContent = myContent.Replace("[TempFinishDate]", temp.TripFinishingDate);
               myContent = myContent.Replace("[TempAdults]", temp.AdultsNum);
               myContent = myContent.Replace("[TempChildL6]", temp.ChildNumL6);
               myContent = myContent.Replace("[TempChildF6T12]", temp.ChildNumF6T12);
               myContent = myContent.Replace("[TempChildR12]", temp.ChildNumR12);
               myContent = myContent.Replace("[TempSpecialRQ]", temp.SpecialRQ);
               if (temp.Accommodations == "1")
               {
                   myContent = myContent.Replace("[TempCheck1]", "checked='true'");
                   myContent = myContent.Replace("[TempCheck2]", "");
                   myContent = myContent.Replace("[TempCheck3]", "");
                   myContent = myContent.Replace("[TempCheck4]", "");
                   myContent = myContent.Replace("[TempCheck5]", "");
               }
               else if (temp.Accommodations == "2")
               {
                   myContent = myContent.Replace("[TempCheck1]", "");
                   myContent = myContent.Replace("[TempCheck2]", "checked='true'");
                   myContent = myContent.Replace("[TempCheck3]", "");
                   myContent = myContent.Replace("[TempCheck4]", "");
                   myContent = myContent.Replace("[TempCheck5]", "");
               }
               else if (temp.Accommodations == "3")
               {
                   myContent = myContent.Replace("[TempCheck1]", "");
                   myContent = myContent.Replace("[TempCheck2]", "");
                   myContent = myContent.Replace("[TempCheck3]", "checked='true'");
                   myContent = myContent.Replace("[TempCheck4]", "");
                   myContent = myContent.Replace("[TempCheck5]", "");
               }
               else if (temp.Accommodations == "4")
               {
                   myContent = myContent.Replace("[TempCheck1]", "");
                   myContent = myContent.Replace("[TempCheck2]", "");
                   myContent = myContent.Replace("[TempCheck3]", "");
                   myContent = myContent.Replace("[TempCheck4]", "checked='true'");
                   myContent = myContent.Replace("[TempCheck5]", "");
               }
               else if (temp.Accommodations == "5")
               {
                   myContent = myContent.Replace("[TempCheck1]", "");
                   myContent = myContent.Replace("[TempCheck2]", "");
                   myContent = myContent.Replace("[TempCheck3]", "");
                   myContent = myContent.Replace("[TempCheck4]", "");
                   myContent = myContent.Replace("[TempCheck5]", "checked='true'");
               }
            myContent = myContent.Replace("[TempArrivalDate]", temp.Arrivaldate);
            myContent = myContent.Replace("[TempFlightNo]", temp.FlightNo);
            myContent = myContent.Replace("[TempDep]", temp.DepartureDate);
            myContent = myContent.Replace("[TempFlightDep]", temp.FlightNoDep);
            myContent = myContent.Replace("[TempNamePassport]", temp.NamePassport);
            myContent = myContent.Replace("[TempCitizenship]", temp.Citizenship);
            myContent = myContent.Replace("[TempOccupation]", temp.Occupation);
            myContent = myContent.Replace("[TempPassportNo]", temp.PassportNo);
            myContent = myContent.Replace("[TempDateOfBird]", temp.DateOfBirth);
            myContent = myContent.Replace("[TempIssueDate]", temp.IssueDate);
            myContent = myContent.Replace("[TempExpirationDate]", temp.ExpirationDate);
            return myContent;
            }
            catch (Exception)
            {
                
                throw;
            }
        }
               
    }
}
